#set($layout = "login.html")
<form class="form-signin" action="index.html">
	<div class="form-signin-heading text-center">
		<h1 class="sign-title">用户登录</h1>
		<img src="$!{base}/resources/images/login-logo.png" alt="">
	</div>
	<div class="login-wrap">
		<input type="text" class="form-control" placeholder="请输入用户名" autofocus id="userName" value="$!obj.data.userName"> <input id="password" type="password" class="form-control" placeholder="请输入密码" value="$!obj.data.password">
		<button class="btn btn-lg btn-login btn-block" type="button">
			<i class="fa fa-check"></i> 登录
		</button>

		<div class="registration">
			没有用户? <a class="" href="registration.html"> 点击注册 </a>
		</div>
		<label class="checkbox"> <input type="checkbox" id="remember_me" $!obj.data.rememberMe> 记住我 <span class="pull-right"> <a data-toggle="modal" href="#forgotPassword"> 忘记密码?</a>
		</span>
		</label>
	</div>

	<!-- 忘记密码 -->
	<div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="forgotPassword" class="modal fade">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title">忘记密码 ?</h4>
				</div>
				<div class="modal-body">
					<p>请输入您的邮箱地址.</p>
					<input type="text" name="email" placeholder="请输入邮箱地址" autocomplete="off" class="form-control placeholder-no-fix">

				</div>
				<div class="modal-footer">
					<button data-dismiss="modal" class="btn btn-primary" type="button">
						<i class="fa fa-reply"></i> 取消
					</button>
					<button class="btn btn-default" type="button">
						<i class="fa fa-rocket"></i> 提交
					</button>
				</div>
			</div>
		</div>
	</div>
	<!-- modal -->
</form>
<script type="text/javascript">
	$('.btn-login').click(function() {
		$.post(getRootPath() + "/system/login", {
			userName : $('#userName').val(),
			password : $('#password').val(),
			rememberMe : $('#remember_me')[0].checked
		}, function(result) {
			console.log(result);
			if (result.operationState == 'SUCCESS') {
				location.href = getRootPath() + "/system/main"
			} else {
				showMessage(result.data.reason);
			}
		}, 'json')
	})
</script>